import {
    Configuration,
    ConfigurationParameters,
} from "../";

import {
{{#apiInfo}}
{{#apis}}
    {{classFilename}},
{{/apis}}
{{/apiInfo}}
} from "./";

export class Api {
{{#apiInfo}}
{{#apis}}
    public static {{#lambda.camelcase}}{{classFilename}}{{/lambda.camelcase}}: {{classFilename}};
{{/apis}}
{{/apiInfo}}

    public static init(apiBasePath: string) {
        const apiBaseConfig: ConfigurationParameters = {
            basePath: apiBasePath,
            credentials: "include",
            headers: {
                'Cache-Control': 'no-cache, no-store' // this is needed to prevent stalling issues in Chrome. Also it is a good behavior for api calls.
            }
        };

{{#apiInfo}}
{{#apis}}
        Api.{{#lambda.camelcase}}{{classFilename}}{{/lambda.camelcase}} = new {{classFilename}}(new Configuration(apiBaseConfig));
{{/apis}}
{{/apiInfo}}
    }
}